package concurrent.BlockingQueue;

import java.util.concurrent.BlockingQueue;

public class Consumer implements Runnable{  
	  
    protected BlockingQueue queue = null;  
  
    public Consumer(BlockingQueue queue) {  
        this.queue = queue;  
    }  
  
    public void run() {  
        try {  
        	Thread.sleep(2000);
        	for(int i=0; i<100; i++) {
        		System.out.println(queue.take()); 
                Thread.sleep(100);
        	}
        } catch (InterruptedException e) {  
            e.printStackTrace();  
        }  
        System.out.println("Consumer线程结束");
    }  
} 
